<?php
error_reporting(E_ERROR);
require_once 'phpqrcode/phpqrcode.php';

$content = null;
$name = null;

$response = array();

if(array_key_exists("content",$_POST) && array_key_exists("name",$_POST))
{
    $content = trim($_POST["content"]);
    $name = trim($_POST["name"]);
}else{
    $response["code"] = 400;
    $response["reason"] = "post 字段错误";
    echo $response;
    return;
}
QRcode::png($content, 'storage/upload/'.$name, QR_ECLEVEL_L, 11, '0');
$response["code"] = 200;
$response["reason"] = "ok";
echo $response;
return;
